package com.community.backend.service.impl;

import cn.hutool.system.UserInfo;
import com.community.backend.mapper.AdminMapper;
import com.community.backend.pojo.Admin;
import com.community.backend.pojo.dto.LoginDTO;
import com.community.backend.pojo.dto.RegisterDTO;
import com.community.backend.service.AdminService;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    private final AdminMapper adminMapper;

    public AdminServiceImpl(AdminMapper adminMapper) {
        this.adminMapper = adminMapper;
    }

    @Override
    public void register(RegisterDTO registerDTO) {
        adminMapper.register(registerDTO);
    }

    @Override
    public Admin login(LoginDTO loginDTO) {
        Admin admin = adminMapper.login(loginDTO.getUsername(), loginDTO.getPassword());
        return admin;
    }
}
